// pages/order/index.js
import { request } from '../../request/index.js';
import regeneratorRuntime from '../../lib/runtime/runtime';
Page({

  /**
   * 页面的初始数据
   */
  data: {
    tabs:[
      {
        id:0,
        value:'全部',
        isActive:true
      },
      {
        id:1,
        value:'待付款',
        isActive:false
      },
      {
        id:2,
        value:'待发货',
        isActive:false
      },
      {
        id:1,
        value:'退货/退款',
        isActive:false
      }
    ]
  },
  onShow(options){
    let pages= getCurrentPages();
    let currentPage=pages[pages.length-1];
    console.log(currentPage.options);
      
  },
  handleTabsItemChange(e){
    // console.log(e);
    // 1 获取被点击的标题索引
    const {index} = e.detail;
    // 2 修改原数组
    let {tabs} = this.data;
    tabs.forEach((v,i)=>i===index?v.isActive=true:v.isActive=false);
    // 3 复制到data中
    this.setData({
      tabs
    })
  },
})